package File;

import ooday04.Test;

import java.io.File;
import java.io.FileFilter;

public class ListFilesDemo2 {
    public static void main(String[] args) {
        File dir=new File(".");
        if(dir.isDirectory()){
            FileFilter fileter=new FileFilter() {
                @Override
                public boolean accept(File file) {
                    String name=file.getName();


                    return name.endsWith(".txt");
                }
            };
            File[]subs=dir.listFiles(fileter);
            for(File sub:subs){
                System.out.println(sub.getName());
            }
        }




    }
}



















